package com.vn.rainbow.exoalarm.ui;

import android.content.Context;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import android.widget.FrameLayout;

import com.vn.rainbow.exoalarm.utils.Utils;

public abstract class BaseView extends FrameLayout {

	protected Context mContext;
	protected float density;
	protected float screenWidth, screenHeight;
	protected float w, h;

	public BaseView(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
		getScreenSize();
		mContext = context;
		density = getResources().getDisplayMetrics().density;
		init();

		setWillNotDraw(false);
		invalidate();
		setClickable(true);
	}

	protected abstract void init();

	protected Paint initPaint() {
		Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
		p.setDither(true);
		p.setAntiAlias(true);
		// p.setFilterBitmap(true);
		return p;
	}

	protected void getScreenSize() {

		WindowManager wm = (WindowManager) getContext().getSystemService(
				Context.WINDOW_SERVICE);
		DisplayMetrics outMetrics = new DisplayMetrics();
		wm.getDefaultDisplay().getMetrics(outMetrics);
		screenWidth = outMetrics.widthPixels;
		screenHeight = outMetrics.heightPixels
				- Utils.getStatusBarHeight(getContext());

	}
}
